package errorx

import (
	"net/http"
)

func ErrorHandler(err error) (int, interface{}) {
	switch e := err.(type) {
	case *CodeError:
		return e.HttpCode, e.Data()
	default:
		return http.StatusInternalServerError, nil
	}

}
